package com.ruoyi.production.service.impl.fertilizer;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.production.mapper.fertilizer.FertilizerTypeMapper;
import com.ruoyi.production.domain.fertilizer.FertilizerType;
import com.ruoyi.production.service.fertilizer.IFertilizerTypeService;

/**
 * 化肥类型Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-12
 */
@Service
public class FertilizerTypeServiceImpl implements IFertilizerTypeService
{
    @Autowired
    private FertilizerTypeMapper fertilizerTypeMapper;

    /**
     * 查询化肥类型
     *
     * @param fertilizerTypeId 化肥类型ID
     * @return 化肥类型
     */
    @Override
    public FertilizerType selectFertilizerTypeById(Long fertilizerTypeId)
    {
        return fertilizerTypeMapper.selectFertilizerTypeById(fertilizerTypeId);
    }

    /**
     * 查询化肥类型列表
     *
     * @param fertilizerType 化肥类型
     * @return 化肥类型
     */
    @Override
    public List<FertilizerType> selectFertilizerTypeList(FertilizerType fertilizerType)
    {
        return fertilizerTypeMapper.selectFertilizerTypeList(fertilizerType);
    }

    /**
     * 新增化肥类型
     *
     * @param fertilizerType 化肥类型
     * @return 结果
     */
    @Override
    public int insertFertilizerType(FertilizerType fertilizerType)
    {
        fertilizerType.setCreateTime(DateUtils.getNowDate());
        return fertilizerTypeMapper.insertFertilizerType(fertilizerType);
    }

    /**
     * 修改化肥类型
     *
     * @param fertilizerType 化肥类型
     * @return 结果
     */
    @Override
    public int updateFertilizerType(FertilizerType fertilizerType)
    {
        fertilizerType.setUpdateTime(DateUtils.getNowDate());
        return fertilizerTypeMapper.updateFertilizerType(fertilizerType);
    }

    /**
     * 批量删除化肥类型
     *
     * @param fertilizerTypeIds 需要删除的化肥类型ID
     * @return 结果
     */
    @Override
    public int deleteFertilizerTypeByIds(Long[] fertilizerTypeIds)
    {
        return fertilizerTypeMapper.deleteFertilizerTypeByIds(fertilizerTypeIds);
    }

    /**
     * 删除化肥类型信息
     *
     * @param fertilizerTypeId 化肥类型ID
     * @return 结果
     */
    @Override
    public int deleteFertilizerTypeById(Long fertilizerTypeId)
    {
        return fertilizerTypeMapper.deleteFertilizerTypeById(fertilizerTypeId);
    }
}
